#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
ZetCode PyQt5 tutorial

This example shows a tooltip on
a window and a button.
按钮和提示框

Author: Jan Bodnar
Website: zetcode.com
Last edited: August 2017
"""
import  sys
from PyQt5.QtWidgets import  (QWidget,QToolTip,QPushButton,QApplication)
from PyQt5.QtGui import QFont

class Example(QWidget):

    def __init__(self):
        super().__init__()

        self.initUI()


    def initUI(self):
        QToolTip.setFont(QFont('SansSerif',10))

        self.setToolTip('This is a <b>QWidget</b>  widget')

        btn =QPushButton("Button",self)
        btn.setToolTip('This is a <b>PushButton</b> wdiget')

        # sizeHint()方法提供了一个默认的按钮大小。
        btn.resize(btn.sizeHint())
        btn.move(50,50)

        self.setGeometry(300,300,300,200)
        self.setWindowTitle("ToolTips显示")
        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())




